﻿using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml.Linq;

namespace Core.Basic {
	public class Contacts : List<Contact> {
		public Contacts( ) {
			this.Load( );
			this.Add(new Contact( ) { Nickname = "Maciek", Description = "Dziś jest kiepski dzień", Avatar = "01.jpg" });
			this.Add(new Contact( ) { Nickname = "sgas", Description = "Dziś jest kiepski dzień", Avatar = "01.jpg" });
			this.Add(new Contact( ) { Nickname = "gdsfhsdfh", Description = "Dziś jest kiepski dzień", Avatar = "01.jpg" });
			this.Add(new Contact( ) { Nickname = "Masdfhfhdsciek", Description = "Dziś jest kiepski dzień", Avatar = "01.jpg" });
			this.Add(new Contact( ) { Nickname = "dfhds", Description = "Dziś jest kiepski dzień", Avatar = "01.jpg" });
			this.Add(new Contact( ) { Nickname = "sdfh", Description = "Dziś jest kiepski dzień", Avatar = "01.jpg" });
			this.Add(new Contact( ) { Nickname = "sadfhgf", Description = "Dziś jest kiepski dzień", Avatar = "01.jpg" });
		}

		public void Load(string Path = null) {
			Path = @"C:\Users\MWorks\Desktop\user\contacts";
			if (Directory.Exists(Path)) {
				DirectoryInfo dir = new System.IO.DirectoryInfo(Path);
				FileInfo[ ] files = dir.GetFiles( );
				foreach (FileInfo file in files) {
					if (file != null) {
						//XDocument xd = XDocument.Load(file.OpenText( ));
						//var data = from item in xd.Descendants("contact")
						//		   select new Contact (
						//			   
						//			   );
						//foreach (var row in data) {
						//	this.Add(row);
						//}
					}
				}
			}
			this.Add(new Contact( ));
		}
	}
}